' ***^^^***|||***^^^***
' 
'  This file is regenerated until it's edited. Delete the file to force regeneration.

'  NOTE: This denotes the way the file was created and it's possible the 
'        generation type has since changed.
'        Check the generation script for the curent state of the file.

' %%%###%%%171917d51f30d5a3b7eccad6242cb875%%%###%%%
' %%%##NoWS##%%%28bae4d76fe1a1a74b06798bff05bc46%%%##NoWS##%%%
' ***^^^***|||***^^^***

  
'************************************************************************************
' Copyright © 2003-2006 Kathleen Dollard
'
' This software is provided 'as-is', without any express or implied warranty. In no 
' event will the author be held liable for any damages arising from the use of this
' software.
' 
' You may use this software for any purpose, including commercial applications, 
' and you may redistribute this software as part of application delivery: however, 
' this copyright notice may not be removed and you may not otherwise redistribute 
' this software directly other than providing a link to wwww.gendotnet.com. 
'
' You may alter this software to better server your needs (I'd like to hear about your 
' changes in order to make the software better). If you alter the softwre, you must  
' clearly mark it as altered and must not be misrepresented as the original software.
' nor wholly your original work.
'*************************************************************************************

Option Explicit On
Option Strict On

Imports System
Imports System.Collections.Generic

Imports KadGen.MetadataWrapper
Imports KadGen.Utility2005

Public Class Build
   Inherits genBuild

#Region "ShouldOutput overrides"
   Protected Overrides Function ShouldOutputSPSetProperty( _
            ByVal propertyName As String, _
            ByVal BuildSPSet As MetadataWrapper.BuildSPSet) _
            As Boolean
      Select Case propertyName.ToLower()
         Case "nochildren"
            Return (BuildSPSet.NoChildren.GetValueOrDefault())
         Case "hasselfjoin"
            Return (BuildSPSet.HasSelfJoin.GetValueOrDefault())
         Case "tablenamecolumnname"
            Return (BuildSPSet.IsMultiParentChild.GetValueOrDefault())
         Case "primarykeycolumnname"
            Return (BuildSPSet.IsMultiParentChild.GetValueOrDefault())
         Case "IsMultiParentChild"
            Return (BuildSPSet.IsMultiParentChild.GetValueOrDefault())
      End Select
      Return MyBase.ShouldOutputSPSetProperty(propertyName, BuildSPSet)
   End Function

   Protected Overrides Function ShouldOutputRetrieveParameterProperty( _
            ByVal propertyName As String, _
            ByVal buildRetrieveParameter As BuildRetrieveParameter) As Boolean
      Select Case propertyName.ToLower()
         Case "maxlength"
            Return (Tools.IsTypeNameString(buildRetrieveParameter.NETType))
      End Select
      Return MyBase.ShouldOutputRetrieveParameterProperty(propertyName, buildRetrieveParameter)
   End Function

   Protected Overrides Function ShouldOutputBuildRecordsetProperty( _
            ByVal propertyName As String, _
            ByVal BuildBuildRecordset As MetadataWrapper.BuildBuildRecordset) _
            As Boolean
      Select Case propertyName.ToLower
         Case "childspset"
            ' Only output if true
            Return Not String.IsNullOrEmpty(BuildBuildRecordset.ChildSPSet)
         Case "temptablename"
            Return Not String.IsNullOrEmpty(BuildBuildRecordset.TempTableName)
         Case "ishierarchy"
            Return BuildBuildRecordset.IsHierarchy.GetValueOrDefault()
      End Select
      Return MyBase.ShouldOutputBuildRecordsetProperty(propertyName, BuildBuildRecordset)
   End Function

   Protected Overrides Function ShouldOutputBuildColumnProperty( _
            ByVal propertyName As String, _
            ByVal BuildBuildColumn As MetadataWrapper.BuildBuildColumn) _
            As Boolean
      Dim ret As Nullable(Of Boolean) = CommonChecks.StandardColumnChecks(propertyName, BuildBuildColumn.NETType)
      If ret.HasValue Then
         Return ret.Value
      Else
         Return MyBase.ShouldOutputBuildColumnProperty(propertyName, BuildBuildColumn)
      End If
   End Function

   Protected Overrides Function ShouldOutputRunSPProperty( _
         ByVal propertyName As String, _
         ByVal BuildRunSP As MetadataWrapper.BuildRunSP) _
         As Boolean
      Select Case propertyName.ToLower
         Case "alternate"
            ' Only output if true
            Return BuildRunSP.Alternate.GetValueOrDefault()
         Case "tempchildtablename"
            Return Not String.IsNullOrEmpty(BuildRunSP.TempChildTableName)
         Case "tempparenttablename"
            Return Not String.IsNullOrEmpty(BuildRunSP.TempParentTableName)
         Case "parentobjectname"
            Return Not String.IsNullOrEmpty(BuildRunSP.ParentObjectName)
         Case "foreignkeyname"
            Return Not String.IsNullOrEmpty(BuildRunSP.ForeignKeyName)
      End Select
      Return MyBase.ShouldOutputRunSPProperty(propertyName, BuildRunSP)
   End Function

   Protected Overrides Function ShouldOutputRunSPParamProperty( _
            ByVal propertyName As String, _
            ByVal BuildRunSPParam As MetadataWrapper.BuildRunSPParam) _
            As Boolean
      Dim ret As Nullable(Of Boolean) = CommonChecks.StandardColumnChecks(propertyName, BuildRunSPParam.NETType)
      If ret.HasValue Then
         Return ret.Value
      Else
         Select Case propertyName.ToLower
            Case "dependentcolumnname"
               Return Not String.IsNullOrEmpty(BuildRunSPParam.DependentColumnName)
            Case "dependenttablename"
               Return Not String.IsNullOrEmpty(BuildRunSPParam.DependentTableName)
            Case "joinbaserootkey"
               Return BuildRunSPParam.JoinBaseRootKey.GetValueOrDefault()
            Case "joinbaseleafkey"
               Return BuildRunSPParam.JoinBaseLeafKey.GetValueOrDefault()
         End Select
         Return MyBase.ShouldOutputRunSPParamProperty(propertyName, BuildRunSPParam)
      End If
   End Function

   Protected Overrides Function ShouldOutputOrderByProperty(ByVal propertyName As String, ByVal BuildOrderBy As MetadataWrapper.BuildOrderBy) As Boolean
      Select Case propertyName.ToLower
         Case "sortorder"
            ' Output specially in overriden 
            Return False
      End Select
      Return MyBase.ShouldOutputOrderByProperty(propertyName, BuildOrderBy)
   End Function

   Protected Overrides Function ShouldOutputTableColumnProperty( _
            ByVal propertyName As String, _
            ByVal BuildTableColumn As MetadataWrapper.BuildTableColumn) _
            As Boolean
      Select Case propertyName.ToLower
         Case "dependentcolumnname"
            Return Not String.IsNullOrEmpty(BuildTableColumn.DependentColumnName)
         Case "dependenttablename"
            Return Not String.IsNullOrEmpty(BuildTableColumn.DependentTableName)
         Case "dependentname"
            Return Not String.IsNullOrEmpty(BuildTableColumn.DependentName)
      End Select
      Return MyBase.ShouldOutputTableColumnProperty(propertyName, BuildTableColumn)
   End Function

   Protected Overrides Function ShouldOutputJoinKeyProperty( _
            ByVal propertyName As String, _
            ByVal BuildJoinKey As MetadataWrapper.BuildJoinKey) _
            As Boolean
      Select Case propertyName.ToLower
         Case "rightcolumnkey"
            Return Not String.IsNullOrEmpty(BuildJoinKey.RightColumnKey)
      End Select
      Return MyBase.ShouldOutputJoinKeyProperty(propertyName, BuildJoinKey)
   End Function

   Protected Overrides Sub OutputOrderByProperties( _
            ByVal xmlWriter As System.Xml.XmlWriter, _
            ByVal BuildOrderBy As MetadataWrapper.BuildOrderBy)
      MyBase.OutputOrderByProperties(xmlWriter, BuildOrderBy)
      If String.Compare(BuildOrderBy.SortOrder, "ascending", True) = 0 Then
         Utility2005.XmlHelpers.WriteAttribute(xmlWriter, "SortOrder", "ASC")
      ElseIf String.Compare(BuildOrderBy.SortOrder, "descending", True) = 0 Then
         Utility2005.XmlHelpers.WriteAttribute(xmlWriter, "SortOrder", "DESC")
      End If
   End Sub

#End Region

End Class

Public Class BuildCollection
	Inherits genBuildCollection

End Class 

	